import React, { Component } from 'react'
// 引入子组件
import Child1 from './Child1'
import Child2 from './Child2'
export default class Father extends Component {
    state = {
        salary1: 10000,
        salary2: 15000
    }
    // 涨薪1
    addSalary1Fn = () => {
        this.setState({
            salary1: this.state.salary1 + 1000
        })
    }
    // 涨薪2
    addSalary2Fn = () => {
        this.setState({
            salary2: this.state.salary2 + 500
        })
    }
    render() {
        const { salary1, salary2 } = this.state
        return (
            <div>
                {/* 使用子组件 */}
                <Child1 salary1={salary1}></Child1>
                <p><button onClick={this.addSalary1Fn}>曲艺博-涨薪+1000</button></p>
                <Child2 salary2={salary2} />
                <p><button onClick={this.addSalary2Fn}>祝芹-涨薪+500</button></p>
            </div>
        )
    }
}
